package org.dtrd.modules.questionnaire.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.modules.questionnaire.entity.bean.QuestionnaireDetail;


/**
 * <p>
 * 调查问卷表
 * </p>
 *
 * @author xiao
 * @since 2022-06-16
 */
@Getter
@Setter
@TableName("dtrd_ent_rd_questionnaire")
public class DtrdEntRdQuestionnaire {

    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    /**
     * 问卷类型
     */
    @TableField("type")
    private String type;

    /**
     * 分类
     */
    @TableField("category")
    private String category;

    /**
     * 缩略图
     */
    @TableField("thumb")
    private String thumb;

    /**
     * 题干
     */
    @TableField("question")
    private String question;

    /**
     * 选项
     */
    @TableField("options")
    private String options;

    /**
     * 排序
     */
    @TableField("sort")
    private Integer sort;

    /**
     * 创建时间
     */
    @TableField("create_time")
    private Date createTime;

    /**
     * 是否删除
     */
    @TableField("is_del")
    @TableLogic
    private Integer isDel;

    public DtrdEntRdQuestionnaire init() {
        createTime = new Date();
        isDel = 0;
        return this;
    }

    public DtrdEntRdQuestionnaire parseFromDto(QuestionnaireDetail dto) {
        dataId = dto.getDataId();
        type = dto.getType();
        category = dto.getCategory();
        thumb = dto.getThumb();
        question = dto.getQuestion();
        options = dto.getOptions();
        sort = dto.getSort();
        return this;
    }


}
